home *** CD-ROM | disk | FTP | other *** search
- //: C25:Cardboard.h
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- // The Cardboard class with prototyping
- #ifndef CARDBOARD_H
- #define CARDBOARD_H
- #include "Trash.h"
-
- class Cardboard : public Trash {
- static double val;
- protected:
- Cardboard() {}
- friend class TrashPrototypeInit;
- public:
- Cardboard(double wt) : Trash(wt) {}
- double value() const { return val; }
- static void value(double newVal) {
- val = newVal;
- }
- std::string id() { return "Cardboard"; }
- Trash* clone(const Info& info) {
- return new Cardboard(info.data());
- }
- };
- #endif // CARDBOARD_H ///:~
-